package com.cykj.pos.controller;

import com.cykj.pos.service.IncomingPartsService;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;


/**
 * @author SunJinDuo
 * @date 2022/7/14
 */
@RestController
@Api(tags = "入件")
@EnableScheduling
public class IncomingPartsController {

    private static final Logger logger = LoggerFactory.getLogger(IncomingPartsController.class);

    @Autowired
    private IncomingPartsService incomingPartsService;

//    @Scheduled(fixedDelay = 50000)
    public void processingData() throws Exception {
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String startTime = df.format(System.currentTimeMillis());
        logger.info("<<<<<--- 开始时间：" + startTime + "。开启入件接口定时任务 --->>>>> -");
        incomingPartsService.processingData();
        String endTime = df.format(System.currentTimeMillis());
        logger.info("<<<<<--- 结束时间：" + endTime + "。立刻执行下次入件接口定时任务 --->>>>> -");
    }
}
